<!-- 
  组件说明：任务清单显示组件，能够显示三条数据。
  配置项：数据源（数组，可选项，默认为空）。
  组件依赖：无。
 -->
<template>
  <div class="task-list" @click="showDialog">
    <div class="task-header">
      <h2>Today</h2>
    </div>
    <div class="task-item" v-for="item in listArr" :key="item">
      <span>{{item}}</span>
    </div> 
  </div>
</template>

<script>
export default {
  props: {
    list: {
      type: Array,
      default: []
    }
  },
  setup(props) {
    const listArr = props.list.splice(0, 3)

    return {
      listArr
    }
  }
}
</script>

<style scoped>
  .task-list {
    width: 180px;
    height: 200px;
    background-image: linear-gradient(to bottom right, #368bf7, #1c60c5);
    border-radius: 10%;
    cursor: pointer;
  }
  .task-list:hover {
    box-shadow: 0 0 3px #666;
  }
  .task-header {
    text-align: center;
    color: #eee;
    height: 60px;
    line-height: 60px;
    border-bottom: 1.5px solid #aaa;
  }
  .task-item {
    height: 45px;
    border-bottom: 1px solid #aaa;
    padding-left: 10px;
    display: flex;
    align-items: center;
  }
  .task-item span{
    color: #ddd;
    word-wrap: none;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
  }
  .task-item:nth-child(4) {
    border: none;
  }
</style>